﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace DatabaseEntegreItri
{
    /// <summary>
    /// Interaction logic for SelectStyle.xaml
    /// </summary>
    public partial class SelectStyle : Window
    {
        public String stil = "BackGroundTemplateBlack";
        public delegate void stilChangedHandler(string stil);
        public event stilChangedHandler stilChanged;
        public SelectStyle()
        {
            InitializeComponent();

            ResourceDictionary myDictionary = Application.LoadComponent(new Uri("/DatabaseEntegreItri;component/Resources/GridStyles.xaml", UriKind.RelativeOrAbsolute)) as ResourceDictionary;

            foreach (String str in myDictionary.Keys) {
                object temp = myDictionary[str];
                if(temp is ControlTemplate){
                    comboBox1.Items.Add(str);   
                }
            }

            comboBox1.SelectedIndex = 0;

            comboBox1.SelectionChanged += new SelectionChangedEventHandler(comboBox1_SelectionChanged);
        }

        void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {                
                GlobalAccess.varVisuals.templateWindow = (ControlTemplate)FindResource(comboBox1.SelectedItem.ToString());                
            }
            catch (Exception) { }
            if (stilChanged != null)
            {
                stilChanged(comboBox1.SelectedItem.ToString());
            }
        }
        
        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                this.DragMove();
            }
            catch (Exception){}
        }
    }
}

